import 'package:flutter/material.dart';
import 'package:get/get.dart';

class LanguagePage extends StatefulWidget {
  const LanguagePage({super.key});

  @override
  State<LanguagePage> createState() => _LanguagePageState();
}

class _LanguagePageState extends State<LanguagePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("国际化") 
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text("hello".tr),
            const SizedBox(height: 20),
            Text("title".tr),
            const SizedBox(height: 20),
            ElevatedButton(onPressed: (){
              var locale = const Locale("zh","CN");
              Get.updateLocale(locale);
            }, child: const Text("中文")),
            ElevatedButton(onPressed: (){
              var locale = const Locale("en","US");
              Get.updateLocale(locale);
            }, child: const Text("英文")),
          ],
        ),
      ),
    );
  }
}
